package o;

import android.content.res.ColorStateList;
import androidx.annotation.ColorInt;
import java.lang.reflect.Field;

public class fmu {
    private static Field ˋ;
    private static Field ˏ;

    public static ColorStateList ˎ(ColorStateList colorStateList, @ColorInt int i, @ColorInt int i2) {
        boolean z = false;
        if (colorStateList == null) {
            return null;
        }
        int[] iArr;
        if (ˏ == null) {
            ˏ = fmt.ˊ(ColorStateList.class, "mColors");
            if (ˏ == null) {
                return null;
            }
        }
        ˏ.setAccessible(true);
        try {
            iArr = (int[]) ˏ.get(colorStateList);
        } catch (IllegalAccessException e) {
            fmq.ˎ("ColorUtils.getTintList() IllegalAccessException1: " + e.getMessage());
            iArr = null;
        }
        if (iArr == null) {
            return null;
        }
        int[] iArr2 = new int[iArr.length];
        for (int i3 = 0; i3 < iArr.length; i3++) {
            iArr2[i3] = iArr[i3];
            int i4 = iArr2[i3] & -16777216;
            if ((iArr2[i3] & 16777215) == (i & 16777215)) {
                iArr2[i3] = (i2 & 16777215) | i4;
                z = true;
            }
        }
        if (!z) {
            return null;
        }
        if (ˋ == null) {
            ˋ = fmt.ˊ(ColorStateList.class, "mStateSpecs");
            if (ˋ == null) {
                return null;
            }
        }
        ˋ.setAccessible(true);
        try {
            int[][] iArr3 = (int[][]) ˋ.get(colorStateList);
            if (iArr3 == null) {
                return null;
            }
            return new ColorStateList(iArr3, iArr2);
        } catch (IllegalAccessException e2) {
            fmq.ˎ("ColorUtils.getTintList() IllegalAccessException2: " + e2.getMessage());
            return null;
        }
    }
}
